﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<div class="fr-widget">
    <div class="fr-widget-header">
        Infomation
    </div>
    <div class="collapse-panel">
        <%using (Html.BeginForm("ForumSave", "Admin", FormMethod.Post, new { @id = "ForumF", @onRequest = "$.MvcForum.showLoading()", @onSuccess = "$.MvcForum.hideLoading()" }))
          {%>
        <%=Html.AntiForgeryTokenX("FORUMSAVE")%>
        <input type="hidden" id="ForumId" name="ForumId" value="0" />
        <table cellpadding="0" cellspacing="5" width="100%">
            <tr>
                <td class="width20">
                    Forum Name
                </td>
                <td>
                    <input type="text" class="input {validate:{required:true}}" name="ForumName" id="ForumName" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Forum parent</strong><br />
                </td>
                <td>
                    <select style="min-width: 220px" id="ParentId" name="ParentId">
                        <option value="0">Root</option>
                        <%
                            var _forums = ForumsRepository.List(0, 500, false);
                            foreach (var forum in _forums)
                            {


                        %>
                        <option value="<%=forum.ForumId%>">
                            <%=ForumContext.Padding(forum.Level)+ forum.ForumName%></option>
                        <%
}%>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Allow Roles</strong>
                </td>
                <td>
                    <%
                        var _roles = RolesRepository.List(); %>
                    <select multiple="multiple" class="dd-converted width50" name="AllowRoles" id="AllowRoles">
                        <%foreach (var role in _roles)
                          {
                          
                        %>
                        <option value="<%=role.RoleId%>">
                            <%=role.RoleName%></option>
                        <%
                            }%>
                    </select>
                    <%--<%=Html.ListBox("AllowRoles",new MultiSelectList(_roles,"RoleId","RoleName",null),new {@class="dd-converted width50"})%>--%>
                </td>
            </tr>
            <tr>
                <td>
                    ModerateType
                </td>
                <td>
                    <%=Html.DropDownList("ModerateType", typeof(ModerateType), ModerateType.None)%>
                </td>
            </tr>
            <tr>
                <td>
                    Keywords
                </td>
                <td>
                    <textarea class="input" style="height: 60px" name="Keywords" id="Keywords"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    SortOrder
                </td>
                <td>
                    <input type="text" class="input {validate:{required:true,digits:true}}" name="SortOrder"
                        id="SortOrder" />
                </td>
            </tr>
            <tr>
                <td>
                    RemoteUrl
                </td>
                <td>
                    <input type="text" class="input {validate:{url:true}}" name="RemoteUrl" id="RemoteUrl" />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input type="checkbox" name="IsLocked" id="IsLocked" value="false" /><label for="IsLocked">IsLocked</label>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input type="checkbox" checked="checked" name="AllowPostWithIn" id="AllowPostWithIn"
                        value="true" /><label for="AllowPostWithIn">Allow Post Within</label>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input type="checkbox" checked="checked" name="VisibleAtHomePage" id="VisibleAtHomePage"
                        value="true" /><label for="VisibleAtHomePage">Visible At HomePage</label>
                </td>
            </tr>
                       

            <tr>
                <td valign="top">
                    Description
                </td>
                <td>
                    <textarea id="Description" name="Description" class="input" style="height: 60px"
                        mode="small"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input type="button" value="Save" id="_save" onclick="$.MvcForum.ajaxSubmit('ForumF')"
                        class="button" />
                    <input type="reset" value="Reset" class="button" />
                </td>
            </tr>
        </table>
        <%
            }%>
    </div>
</div>
<%
    var _forumList = ForumsRepository.List(0, 10, true);

    Html.RenderPartial("ForumList", _forumList);
%>
